package com.bocaizp.operation.controller.admin;

import com.bocaizp.common.result.Result;
import com.bocaizp.operation.service.DataAnalysisService;
import com.bocaizp.pojo.VO.AdminDataHierarchyVO;
import com.bocaizp.pojo.VO.DataForecastVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author : huang jie
 * Date : 2024/5/5 22:48
 **/
@RestController
@RequestMapping("/admin")
@Slf4j
@CrossOrigin
public class AdminAnalysisController {

	@Autowired
	private DataAnalysisService dataAnalysisService;

	/**
	 * 用户分层数据
	 * @return
	 */
	@GetMapping("/analysis/foruser")
	public Result<AdminDataHierarchyVO> adminDataHierarchyVOResult(){
		log.info("用户分层数据请求...");
		AdminDataHierarchyVO adminDataHierarchyVO = dataAnalysisService.getStepData();
		return Result.success(adminDataHierarchyVO);
	}

	/**
	 * 行业预测数据
	 * @return
	 */
	@GetMapping("/analysis/forecast")
	public Result<DataForecastVO> dataForcastVOResult(String industry){
		log.info("行业预测数据请求...");
		DataForecastVO dataForecastVO = dataAnalysisService.getForecastData(industry);
		return Result.success(dataForecastVO);
	}
}
